]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Magnifier: Filter caret tracking in gnome magnifier
authorLee <lclark125@gmail.com>
Sat, 24 Apr 2021 17:03:35 +0000 (18:03 +0100)
committerMarge Bot <marge-bot@gnome.org>
Mon, 28 Jun 2021 21:28:10 +0000 (21:28 +0000)
Add a check to filter out caret tracking events that result in a caret
location of 0,0.

Fixes #4177

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1823>

js/ui/magnifier.js

index 2f0a279a2897c5cfac6bdee8632b3bad69a5c3d7..08466b9a0986a8a597eceae855b2da6a8a317aab 100644 (file)
@@ -827,6 +827,12 @@ var ZoomRegion = class ZoomRegion {
         let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
         let [xCaret, yCaret] = [extents.x * scaleFactor, extents.y * scaleFactor];
 
+        // Ignore event(s) if the caret size is none (0x0). This happens a lot if
+        // the cursor offset can't be translated into a location. This is a work
+        // around.
+        if (extents.width === 0 && extents.height === 0)
+            return;
+
         if (this._xCaret !== xCaret || this._yCaret !== yCaret) {
             [this._xCaret, this._yCaret] = [xCaret, yCaret];
             this._centerFromCaretPosition();